#!/bin/bash
. ./lib

options=()

items=$(pacman -Sqg kde-applications)
for item in $items; do
  case $item in
    "dolphin" | \
    "kate" | \
    "kdebase-kdepasswd" | \
    "kdepasswd" | \
    "kdebase-kdialog" | \
    "kdialog" | \
    "kdebase-kfind" | \
    "kfind" | \
    "konsole" | \
    "kwrite" | \
    "kcron" | \
    "kdeadmin-kuser" | \
    "kuser" | \
    "ksystemlog" | \
    "ark" | \
    "kcalc" | \
    "kcharselect" | \
    "kdeutils-kgpg" | \
    "kgpg" | \
    "kwalletmanager" | \
    "print-manager" | \
    "kdegraphics-okular" | \
    "okular" | \
    "spectacle" | \
    "kmix" | \
    "kdemultimedia-audiocd-kio" | \
    "audiocd-kio" | \
    "kdemultimedia-kmix" | \
    "kmix" | \
    "kdemultimedia-mplayerthumbs" | \
    "mplayerthumbs" | \
    "kdenetwork-filesharing" | \
    "filesharing" | \
    "kdenetwork-zeroconf-ioslave" | \
    "zeroconf-ioslave" | \
    "kio-extras" | \
    "signon-kwallet-extension" | \
    "thumbnailers" | \
    "kdesdk-thumbnailers") options+=("$item" "" on);;
    *) options+=("$item" "" off);;
  esac
done

sel=$(whiptail --backtitle "$apptitle" --title "$package Install :" --checklist "" --cancel-button "Back" 0 0 0 \
  "${options[@]}" \
  3>&1 1>&2 2>&3)

if [ ! "$?" = "0" ]; then
  exit 1
fi

for itm in $sel; do
  pkg="$pkg $(echo $itm | sed 's/"//g')"
done

instpkg "$pkg" "$aurpkg"

exit 0
